Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new operator (~=) to compare strings. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added a new operator (~=) to compare strings. #2

wants to merge 1 commit into from

Conversation

dbmrq
Copy link
Contributor

@dbmrq dbmrq commented Mar 2, 2016

Now you should be able to do this:
"Louis-Ferdinand Céline" ~= "louis ferdinand celine" // true

By default it returns true if the strings are 40% different or less.
This value can be adjusted by changing the tolerance variable in the
operator definition.

I also added an example to the sample app, but I commented it out so as
to not interfere with the regular example.

Now you should be able to do this:
"Louis-Ferdinand Céline" ~= "louis ferdinand celine" // true

By default it returns true if the strings are 40% different or less.
This value can be adjusted by changing the tolerance variable in the
operator definition.

I also added an example to the sample app, but I commented it out so as
to not interfere with the regular example.
@cyrilchandelier
Copy link
Owner

Hi @danielbmarques, thanks for this contribution.

Even if this custom operator makes perfect sense, I am not very comfortable with the idea of imposing its existence to the extension users.

I'm open to discussion, if you are aware of a way to have it optional in projects, please tell me.

@dbmrq
Copy link
Contributor Author

dbmrq commented Mar 26, 2016

No problem then. I just added it for myself and thought I'd share. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants